package com.openlogic.common.logic.decision.common;

import com.openlogic.common.logic.constants.RuleConstants;
import com.openlogic.common.logic.constants.RuleTypeConstants;
import com.openlogic.common.logic.decision.scorecard.model.ScoreCardTableResultVo;
import com.openlogic.common.logic.decision.table.model.DecisionTableResultVo;
import com.openlogic.common.logic.decision.tree.model.TreeNode;

/**
* @ClassName: DecisionEngine
* @Description: 决策引擎抽象父类
* @author weiyongpeng
* @date 2024年9月27日 上午11:07:22
 */
public abstract class DecisionEngine {
	
	protected static Object initExecLog(Object[] execLogArray, String execLogMsg, String decisionType) {
		if (decisionType.equals(RuleTypeConstants.decisionTree.getCode())) {
			TreeNode treeNode = new TreeNode();
			treeNode.setExecStatus(RuleConstants.NODE_EXEC_SUCCESS);
			treeNode.setResult(execLogMsg);
			execLogArray[0] = treeNode;
			return execLogArray;
		}else if(decisionType.equals(RuleTypeConstants.decisionTable.getCode())){
			DecisionTableResultVo decisionTable = new DecisionTableResultVo();
			decisionTable.setExecStatus(RuleConstants.NODE_EXEC_SUCCESS);
			decisionTable.setExecLog(execLogMsg);
			execLogArray[0] = decisionTable;
			return execLogArray;
		}else if(decisionType.equals(RuleTypeConstants.crossDecisionTable.getCode())) {
			DecisionTableResultVo crossDecisionTable = new DecisionTableResultVo();
			crossDecisionTable.setExecStatus(RuleConstants.NODE_EXEC_SUCCESS);
			crossDecisionTable.setExecLog(execLogMsg);
			execLogArray[0] = crossDecisionTable;
			return execLogArray;
		}else if(decisionType.equals(RuleTypeConstants.scoreCard.getCode())) {
			ScoreCardTableResultVo scoreCardTable = new ScoreCardTableResultVo();
			scoreCardTable.setExecStatus(RuleConstants.NODE_EXEC_SUCCESS);
			scoreCardTable.setExecLog(execLogMsg);
			execLogArray[0] = scoreCardTable;
			return execLogArray;
		}
		
		return execLogArray;
	}

}
